package vip.liux.backend.adapter.listerns;


import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import vip.liux.contracts.infrastructure.messaging.MessageBus;

@Component
public class MessagingListener {

    @RabbitListener(bindings =
    @QueueBinding(
            value = @Queue(value = "notification.messaging.queue", durable = "true"),
            exchange = @Exchange(value = "notification.exchange"),
            key = "notification.messaging.send"
    )
    )
    public void listen(String code) {
        try {
            MessageBus.send("68243021718f09cd43c70aa2", "{\"name\": \"Alice\"}", "18571084897");
        } catch (Exception ignore) {
        }
    }
}
